<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>数组求和、求最大值</title>
			<script>
				var arr = [10, 20, 30, 40, 50]; 
				sum(arr);
				max(arr);
				function sum(arr){
					var sum = 0;
				for(var i=0; i<arr.length; i++){
					sum = sum + arr[i];
				}
				console.log("sum = " + sum);
				}
				function max(arr){
					var max = Number.MIN_VALUE;
				for(var i=0; i<arr.length; i++){
					if(arr[i] > max){
						max = arr[i];
					}
				}
				console.log("max = " + max);
				}
			</script>
	</head>
	<body>
		<h1>数组求和、求最大值</h1>
	</body>
</html>
